<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"      
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <h:body>
        <ui:composition template="./WEB-INF/plantillas/plantilla.xhtml">
            
            <ui:define name="content">
                <c:view>
                    <h:form rendered="#{loginManagedBean.usuario.rolId.rolId!=1}">
                        <h1><h:outputText value="#{msgs.alta}"/></h1>
                        <p:growl id="growl" sticky="true" />
                        <h:panelGrid columns="2">
                            <h:outputLabel value="#{msgs.nombre}:" for="name" />
                            <h:inputText id="name" value="#{usuario.nombre}" title="name" required="true" requiredMessage="The Name field is required."/>
                            <h:outputLabel value="#{msgs.apellidos}:" for="surname" />
                            <h:inputText id="surname" value="#{usuario.apellidos}" title="Surname" required="true" requiredMessage="The Surname field is required."/>
                            <h:outputLabel value="#{msgs.dire}:" for="direccion" />
                            <h:inputText id="direccion" value="#{usuario.direccion}" title="direccion" required="true" requiredMessage="The direccion field is required."/>
                            <h:outputLabel value="#{msgs.cp}" for="cp" />
                            <h:inputText id="cp" value="#{usuario.cp}" title="cp" validator="#{signupManagedBean.validarCp}" required="true" requiredMessage="The cp field is required."/>
                            <h:outputLabel value="#{msgs.tlfo}" for="telefono" />
                            <h:inputText id="telefono" value="#{usuario.telefono}" title="telefono" validator="#{signupManagedBean.validarTelefono}" required="true" requiredMessage="The telefono field is required."/>
                            <h:outputLabel value="#{msgs.localidad}" for="localidad" />
                            <h:inputText id="localidad" value="#{usuario.localidad}" title="localidad" required="true" requiredMessage="The localidad field is required."/>
                            <h:outputLabel value="#{msgs.provincia}" for="provincia" />
                            <h:inputText id="provincia" value="#{usuario.provincia}" title="provincia" required="true" requiredMessage="The provincia field is required."/>
                            <h:outputLabel value="Email:" for="email" />
                            <h:outputLabel value="#{usuario.email}" title="Email" />
                            <h:outputLabel value="#{msgs.pass}:" for="password" />
                            <h:inputSecret id="password" value="#{usuario.password}" title="Password" required="true" requiredMessage="The Password field is required."/>
                            <h:outputLabel value="Re#{msgs.pass}:" for="repassword" />
                            <h:inputSecret id="repassword" value="#{signupManagedBean.repassword}" title="RePassword" required="true" requiredMessage="The RePassword field is required."/>
                            <h:panelGrid columns="1" rendered="#{loginManagedBean.usuario.rolId.rolId == 3}" >
                            <h:outputLabel value="Rol" for="roles" />
                                <h:selectOneListbox value="#{usuario.rolId.descripcion}" id="rol" required="true">
                                    <c:selectItems value="#{signupManagedBean.listaRoles}"/>
                                </h:selectOneListbox>
                            </h:panelGrid>
                            <br/>
                            <h:commandLink value="#{msgs.elimPerfil}" action="#{signupManagedBean.deleteProfile(usuario)}" />
                            <h:commandButton value="#{msgs.editar}" action="#{signupManagedBean.editProfile}" />
                            <h:button value="#{msgs.cancelar}" outcome="index" />
                        </h:panelGrid>
                    </h:form>
                </c:view>
            </ui:define>

        </ui:composition>
    </h:body>
</html>
